SoundCloud v2 API
参考文献
Client IDの取得方法
clind_id: DgFeY88vapbGCcK7RrT2E33nmNQVWX82とする.
SoundCloud v2 APIのClient IDの取得方法は↓を参照.
大雑把にはhttps://soundcloud.comで取ってくる<script>を片っ端から探してclient_idを取ってこれば良い.
URLから音源情報を取ってくる
↓のURLの情報を取ってくるとする
https://soundcloud.com/pr0tein/ubfhfythunwo
https://soundcloud2image.vercel.app/image?url=https://soundcloud.com/pr0tein/ubfhfythunwo#.png https://soundcloud.com/pr0tein/ubfhfythunwo
https://api-v2.soundcloud.com/resolve?clinet_id={clinet_id}&url={url}で取得可能.
結果:
code:result.json
{
"caption": null,
"commentable": true,
"comment_count": 2,
"created_at": "2023-03-15T03:23:03Z",
"description": "",
"downloadable": false,
"download_count": 0,
"duration": 86126,
"full_duration": 86126,
"embeddable_by": "all",
"genre": "",
"has_downloads_left": false,
"id": 1469143378,
"kind": "track",
"label_name": null,
"last_modified": "2023-03-15T05:07:34Z",
"license": "all-rights-reserved",
"likes_count": 25,
"permalink": "ubfhfythunwo",
"playback_count": 338,
"public": true,
"publisher_metadata": {
"id": 1469143378,
"urn": "soundcloud:tracks:1469143378",
"contains_music": true
},
"purchase_title": null,
"purchase_url": null,
"release_date": null,
"reposts_count": 4,
"secret_token": null,
"sharing": "public",
"state": "finished",
"streamable": true,
"tag_list": "",
"title": "真島 茂樹(?)",
"track_format": "single-track",
"urn": "soundcloud:tracks:1469143378",
"user_id": 1079172964,
"visuals": null,
"display_date": "2023-03-15T03:23:03Z",
"media": {
"transcodings": [
{
"preset": "mp3_1_0",
"duration": 86126,
"snipped": false,
"format": {
"protocol": "hls",
"mime_type": "audio/mpeg"
},
"quality": "sq"
},
{
"preset": "mp3_1_0",
"duration": 86126,
"snipped": false,
"format": {
"protocol": "progressive",
"mime_type": "audio/mpeg"
},
"quality": "sq"
},
{
"preset": "opus_0_0",
"duration": 86106,
"snipped": false,
"format": {
"protocol": "hls",
"mime_type": "audio/ogg; codecs=\"opus\""
},
"quality": "sq"
}
]
},
"station_urn": "soundcloud:system-playlists:track-stations:1469143378",
"station_permalink": "track-stations:1469143378",
"track_authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnZW8iOiJKUCIsInN1YiI6IiIsInJpZCI6IjZhOWZiNjY5LWU4NmYtNDk4NC1iNGEwLWZmYWIzOGU0MjE4NCIsImlhdCI6MTY4NDMwMDg0MH0.tY4l2x39ucf1_pQzpxKuCY-i0taKHLMQ1-mA2xD8V_I",
"monetization_model": "NOT_APPLICABLE",
"policy": "ALLOW",
"user": {
"city": null,
"comments_count": 0,
"country_code": null,
"created_at": "2022-01-28T11:46:43Z",
"creator_subscriptions": [
{
"product": {
"id": "free"
}
}
],
"creator_subscription": {
"product": {
"id": "free"
}
},
"description": null,
"followers_count": 74,
"followings_count": 20,
"first_name": "",
"full_name": "",
"groups_count": 0,
"id": 1079172964,
"kind": "user",
"last_modified": "2022-11-09T13:56:28Z",
"last_name": "",
"likes_count": 56,
"playlist_likes_count": 0,
"permalink": "pr0tein",
"playlist_count": 0,
"reposts_count": null,
"track_count": 14,
"urn": "soundcloud:users:1079172964",
"username": "筋肉",
"verified": false,
"visuals": null,
"badges": {
"pro": false,
"pro_unlimited": false,
"verified": false
},
"station_urn": "soundcloud:system-playlists:artist-stations:1079172964",
"station_permalink": "artist-stations:1079172964"
}
}
IDから情報を取ってくる
https://api-v2.soundcloud.com/resolve?client_id=DgFeY88vapbGCcK7RrT2E33nmNQVWX82&ids={id1},{id2},...,{idn}
取れるものは↑と大体同じなので省略
埋め込みウィジェット